{% extends 'base.html' %}

{% block title %}注册 - {{ site_info.site_name }}{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header bg-primary text-white">
                <h2 class="mb-0">注册新账户</h2>
            </div>
            <div class="card-body">
                <form method="post">
                    {% csrf_token %}
                    
                    {% for field in form %}
                        <div class="mb-3">
                            <label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
                            {{ field.errors }}
                            {{ field }}
                            {% if field.help_text %}
                                <div class="form-text">{{ field.help_text }}</div>
                            {% endif %}
                        </div>
                    {% endfor %}
                    
                    <div class="d-grid gap-2 mt-4">
                        <button type="submit" class="btn btn-primary">注册</button>
                    </div>
                </form>
                
                <div class="text-center mt-3">
                    <p>已有账户？<a href="{% url 'login' %}">登录</a></p>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block extra_js %}
<script>
    // 添加Bootstrap样式到表单字段
    document.addEventListener('DOMContentLoaded', function() {
        document.querySelectorAll('input[type="text"], input[type="password"]').forEach(function(input) {
            input.classList.add('form-control');
        });
    });
</script>
{% endblock %} 